package com.example.novelstory.controller.dxy;

import com.example.novelstory.entity.Author;
import com.example.novelstory.service.dxy.AuthorServicelmpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * author:daixiaoyi
 */

@Api(tags ="作者管理")
@CrossOrigin
@RestController
public class AuthorController {
    @Resource
    AuthorServicelmpl authorService;

    @PostMapping(value = "/findauthorAll")
//    @ResponseBody
    @ApiOperation(value = "全查3")
    public List<Author> findauthorAll() {
//        List<Author> allauthorUser = authorService.findauthorAll();
        return authorService.list();
    }

//    @ResponseBody
    @PostMapping(value = "/addauthor")
    @ApiOperation(value = "增加3")
    public Boolean addauthorInfo(Author author){
//        List<Author> addauthorInfo = authorService.addauthorInfo(id,authorname,username,login_time);
        return authorService.addauthorInfo(author);

    }

//    @ResponseBody
    @PostMapping(value = "/deleteauthor")
    @ApiOperation(value = "删除3")
    public Boolean deleteauthorInfo(int id) {
//        List<Author> deleteauthorInfo = authorService.deleteauthorInfo(id);
        return authorService.deleteauthorInfo(id);

    }

//    @ResponseBody
    @PostMapping(value = "/updeteauthor")
    @ApiOperation(value = "修改3")
    public Boolean updeteauthorInfo(Author author) {
//        List<Author> updeteauthorInfo = authorService.updeteauthorInfo(id,authorname,username,login_time);
        return authorService.updeteauthorInfo(author);
    }

}
